const got = require('got');
const querystring = require("querystring");
exports.main = async (event, context) => {
  let token = event.token
  let url = "https://aip.baidubce.com/rest/2.0/image-classify/v2/advanced_general?access_token=" + token
  let image = event.image

  postResponse = await got.post(url, {
    body: querystring.stringify({
      image: image
    })
  });
  let responseJson = JSON.parse(postResponse.body);
  console.log(responseJson.words_result)
  return responseJson
}